package com.fc.base.init;


import org.objectweb.asm.ClassAdapter;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;

public class ClassAdpater extends ClassAdapter {
	public ClassAdpater(ClassVisitor cv) {
		// Responsechain 的下一个 ClassVisitor，这里我们将传入 ClassWriter，
		// 负责改写后代码的输出
		super(cv);
	}
	
	// 修改够造函数
	public MethodVisitor visitMethod(final int access, final String name,
			final String desc, final String signature, final String[] exceptions) {
		MethodVisitor mv = cv.visitMethod(access, name, desc, signature,
				exceptions);
		MethodVisitor wrappedMv = mv;
		if (mv != null) {
			// 对于 "operation" 方法
			if (name.equals("<init>")) {
				// 使用自定义 MethodVisitor，实际改写方法内容
//				wrappedMv = new AddSecurityCheckMethodAdapter(mv);
			}
		}
		return wrappedMv;
	}

	public FieldVisitor visitField(int arg0, String arg1, String arg2,
			String arg3, Object arg4) {
		
		return super.visitField(arg0, arg1, arg2, arg3, arg4);
	}
	
	
}
